﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Basic4Net.OAWeb.Base;
using System.ComponentModel;

namespace OAWeb.CustomControl
{
	public partial class CustomBlockControl : BaseUserControl
	{
		/// <summary>
		/// 模块标题
		/// </summary>
		public string BlockTitle { get; set; }

		/// <summary>
		/// 模块类型
		/// </summary>
		public string BlockType { get; set; }

		/// <summary>
		/// 模块对应数据库的ID
		/// </summary>
		[DefaultValue(0)]
		public int BlockID { get; set; }

		/// <summary>
		/// 显示多少条记录
		/// </summary>
		[DefaultValue(10)]
		public int ShowCount { get; set; }

		protected void Page_Load(object sender, EventArgs e)
		{
			if (IsPostBack) return;

			Bind();
		}

		/// <summary>
		/// 
		/// </summary>
		protected void Bind()
		{

		}

		/// <summary>
		/// Repeater ItemDataBound 事件
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		protected void rpContent_ItemDataBound(object sender, RepeaterItemEventArgs e)
		{
			if (e.Item.ItemIndex == -1) return;
			DataBindItem item = (DataBindItem)e.Item.DataItem;
			if (item == null) return;
			Literal litLink = (Literal)e.Item.FindControl("litLink");
			if (litLink == null) return;
		}
	}

	/// <summary>
	/// 数据绑定类
	/// </summary>
	[Serializable]
	public class DataBindItem
	{
		/// <summary>
		/// 主键ID
		/// </summary>
		[DefaultValue(0)]
		public int ItemID { get; set; }

		/// <summary>
		/// 项目名
		/// </summary>
		public string ItemName { get; set; }

		/// <summary>
		/// 项目类型
		/// </summary>
		public string ItemType { get; set; }

		/// <summary>
		/// 项目Url
		/// </summary>
		public string ItemUrl { get; set; }

		/// <summary>
		/// 项目日期
		/// </summary>
		public DateTime ItemDate { get; set; }
	}
}